﻿using System.IO;
using System.Text.RegularExpressions;
using NETDeob.Core.Deobfuscators;
using NETDeob.Core.Deobfuscators.Confuser._1_9;
using System;
using System.Collections.Generic;

namespace NETDeob.Core.Identification.Obfuscators.Confuser
{
    public class Confuser19 : IProtection
    {
        public ProtectionType Type
        {
            get { return ProtectionType.Obfuscator; }
        }

        public String Name
        {
            get { return "Confuser 1.9"; }
        }

        public Version Version
        {
            get { return new Version("1.9.0.0"); }
        }

        public List<IRoutine> Routines
        {
            get
            {
                return new List<IRoutine>
                {
                    new Unpacker(),
                    new Anti_Debug()
                };
            }
        }

        public Boolean Identify(String target)
        {
            var pattern = new Regex("Confuser v[0-9].[0-9].[0-9].[0-9]");
            var match = pattern.Match(File.ReadAllText(target));

            return match.Success && match.Value == "Confuser v1.9.0.0";
        }
    }
}
